package com.cwm.test.single;

class Parent {
    static String staticParentField = "静态父类字段";
    String instanceParentField = "实例父类字段";
 
    static {
        System.out.println(staticParentField);
        System.out.println("静态父类初始化块");
    }
 
    {
        System.out.println(instanceParentField);
        System.out.println("实例父类初始化块");
    }
 
    public Parent() {
        System.out.println("父类构造函数");
    }
}
 
class Child extends Parent {
    static String staticChildField = "静态子类字段";
    String instanceChildField = "实例子类字段";
 
    static {
        System.out.println(staticChildField);
        System.out.println("静态子类初始化块");
    }
 
    {
        System.out.println(instanceChildField);
        System.out.println("实例子类初始化块");
    }
 
    public Child() {
        System.out.println("子类构造函数");
    }
}
 
public class InitializationOrder {
    public static void main(String[] args) {
        new Child();
    }
}